package demo1;
import java.io.*;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2024-01-01
 * Time: 18:44
 */
public class CopyFile {

    public static void copyFile(String sourceFileName, String targetFileName) throws Exception {
        FileInputStream in = new FileInputStream(sourceFileName);
        FileOutputStream out = new FileOutputStream(targetFileName);
        int data = 0;
        while ((data = in.read())!= -1){
            out.write(data);
        }
        in.close();
        out.close();
    }
}
